package com.farsight.leo.fssmartlock.utils;

import android.widget.Toast;

import com.farsight.leo.fssmartlock.bases.BaseApplication;

/**
 * Author: Administrator
 * Date: 2019/9/16
 * Project: SmartLockApp
 * Description:
 */
public class ToastUtils {
    private static ToastUtils instance;
    private static Toast toast;

    private ToastUtils() {

    }

    public static void showToast(String msg) {
        if (instance == null) {
            synchronized (ToastUtils.class) {
                if (instance == null) {
                    instance = new ToastUtils();
                }
            }
        }

        if (toast == null) {
            toast = Toast.makeText(BaseApplication.acquireBaseContext(), msg, Toast.LENGTH_SHORT);
        } else {
            toast.setText(msg);
        }
        toast.show();
    }
}
